package com.guochenglang.www.dao;

import com.guochenglang.www.pojo.Member;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author GuoChenglang
 */
public interface MemberDao {
    /**
     * 搜索成员表
     *
     * @param member 搜索条件
     * @return 成员列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Member> memberSelect(Member member) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 分页查询成员表
     *
     * @param page   当前页码
     * @param num    每页个数
     * @param member 搜索条件
     * @param order  排序条件
     * @param mode   升序还是降序
     * @return 成员列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Member> memberSelectByLimit(int page, int num, Member member, String order, String mode) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 添加成员
     *
     * @param member 成员信息
     * @return 添加的键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int insertMember(Member member) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 更新成员状态
     *
     * @param set        更新数据
     * @param conditions 更新的条件
     * @return 更新行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int updateMember(Member set, Member conditions) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 删除成员
     *
     * @param conditions 删除条件
     * @return 删除行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int deleteMember(Member conditions) throws SQLException, InterruptedException, IllegalAccessException;
}
